package com.imooc.o2o.util;/**
 * @package: com.imooc.o2o.util
 * @data: 2018/8/27
 * @author: 70918
 */

import com.google.code.kaptcha.Constants;

import javax.servlet.http.HttpServletRequest;

/**
 * @author     ：zglx
 * Date       ：Created in 19:59 2018/8/27
 * Description：TODO
 * version:     V1.0
 */
public class CodeUtil {
    public static boolean checkVerifyCode(HttpServletRequest request) {
        String verifyCodeExcepted = (String)request.getSession().getAttribute(
                com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
        String verifyCodeActual = HttpServletRequestUtil.getString(request, "verifyCodeActual");
        if (verifyCodeActual == null || !verifyCodeActual.equals(verifyCodeExcepted)) {
            return false;
        }
        return true;
    }
}
